<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 450px;
            height: 450px;
        }
    </style>
</head>


<body>
    <button id="huge">胡歌</button>
    <button id="huojianhua">霍建华</button> <br>
    <img src="images/胡歌.jpg" alt="" title="胡歌">

    <script>
        //修改元素属性
        //获取元素
        var huge = document.getElementById('huge');
        var huojianhua = document.getElementById('huojianhua');
        var img = document.querySelector('img');

        //注册事件
        huojianhua.onclick = function () {
            img.src = "images/霍建华.jpg";
            img.title = '霍建华';
        }

        huge.onclick = function () {
            img.src = "images/胡歌.jpg";
            img.title = '胡歌';
        }

    </script>
</body>

</html>